<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    for( var n = 100; n < 1000;n++){
        if(fun(n)){
           console.log(n); 
        }
    } 
    function fun(num) {
        var str = '' + num;
        var ge = +str[2];
        var shi = +str[1];
        var bai = +str[0];
        // console.log(ge,shi,bai)
        var ge1 = 1; 
        while (ge){
        //    ge1 *= ge;
            ge1 = ge1 * ge;
            ge--;   
        }
        // console.log(ge1); 
        var shi1 = 1;
        while(shi){
            shi1 = shi1 * shi;
            shi--;
            // console.log(shi1);
        }
        var bai1 = 1;
        while(bai){
            bai1 = bai1 * bai;
            bai--;
        }
        // console.log(bai1); 
        // console.log(ge1+shi1+bai1);
        return (ge1 + shi1 + bai1) === num;

    } 

        

    </script>
</body>